#!/usr/bin/env node

// let msg = 'zita';

// //string->encoding
// let utf8 = Buffer.from(msg,'utf8');

// console.log(utf8)

//decoding
// console.log(utf8.toString('utf8'))
//编码 base64 a.txt 解码 base64 -d b.txt
//////////////////////////////////
const userName  = process.argv[2];
//获取姓名
const password = process.argv[3];
//获取密码
console.log(userName,password);

const msg = `${userName}:${password}`;
//拼接
console.log(msg)
const buf = Buffer.from(msg);
console.log('base64',buf.toString('base64'));
//转为base64编码

//浏览器环境下使用
// const buf2 = btoa(unescape(encodeURIComponent(str)));
// console.log(buf2)

